<template>
  <div class="background-white">
    <div class="update-info">
      <div class="margin-16">
        <el-input
          placeholder="名称"
          v-model="editObj.name"
          clearable>
        </el-input>
      </div>
      <div class="margin-16">
        <el-row>
          <el-col :span="2">
            <span class="first-left"><span style="color: #cc0000"> *</span>上传图片：</span>
          </el-col>
          <el-col :span="7">
            <upload :limit="1" :errorTitle="'只能上传1张照片'"></upload>
          </el-col>
        </el-row>
      </div>
      <div class="margin-16">
        <el-row>
          <el-col :span="2">
            <span class="first-left">是否发布：</span>
          </el-col>
          <el-col :span="7">
            <el-dropdown :hide-on-click="false">
  <span class="el-dropdown-link">
    选择是否发布<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>是</el-dropdown-item>
                <el-dropdown-item>否</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </div>

      <div class="margin-16">
        <el-row>
          <el-col :span="2">
            <span class="first-left"><span style="color: #cc0000"> *</span>上传图片：</span>
          </el-col>
          <el-col :span="7">
            <el-input
              placeholder="备注"
              type="textarea"
              :autosize="{ minRows: 5, maxRows: 14}"
              v-model="editObj.note"
              clearable>
            </el-input>
          </el-col>
        </el-row>

      </div>
    </div>
    <div>
      <div style="padding-top: 16px;padding-bottom: 16px">
        <el-row>
          <el-col :span="6" :offset="3">
            <el-button type="danger" size="mini">保存</el-button>
            <el-button size="mini" v-if="isEdit">删除</el-button>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
  import editor from "~/components/editor";
  import upload from "~/components/uploadImg";

  export default {
    name: "update",
    components: {
      editor,
      upload
    },
    props: {
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      editObj: {
        type: Object,
        default: () => {
          return {};
        }
      },
    },
    data() {
      return {}
    },
    methods: {
      deleteRow(id) {
        this.$emit('deleteRow', {id: id})
      },
    }
  }
</script>

<style scoped lang="scss">

</style>
